package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName: SetmealMapper
 * Package: com.sky.mapper
 * Description:
 *
 * @Author 八云
 * @Create 2025/3/20 21:36
 * @Version 1.0
 */

@Mapper
public interface SetmealMapper {

    //套餐分页查询
    Page<SetmealVO> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);

    //新增套餐
    @AutoFill(OperationType.INSERT)
    void save(Setmeal setmeal);

    // 根据id查询套餐
    SetmealDTO getByIdWithDish(Long id);

    //修改套餐
    @AutoFill(OperationType.UPDATE)
    void update(Setmeal setmeal);

    void startOrStop(Integer status, Long id);

    void deleteBatch(List<Long> ids);

    Dish getById(Long id);

    @Select("SELECT name FROM setmeal WHERE id = #{setmealId} and status = #{status}")
    String getByIdStatus(Long setmealId, Integer status);

    Integer getSetmealsStatus(Integer map);
}
